package net.bmwgroup.easyrule.demo.actions;

import org.jeasy.rules.api.Action;
import org.jeasy.rules.api.Facts;

import java.util.HashMap;
import java.util.Map;

public class ActionFactory {
    private Map<String, Action> actions = new HashMap<>();
    private Facts facts;

    public ActionFactory(Facts facts) {
        this.facts = facts;
        this.initActions();
    }

    public void initActions() {
        AirConditionerAction airConditionerAction = new AirConditionerAction(facts);
        this.actions.put("AirConditionerAction", airConditionerAction);
        WindowAction windowAction = new WindowAction(facts);
        this.actions.put("WindowAction", windowAction);
        TestAction testAction = new TestAction(facts);
        this.actions.put("TestAction", testAction);


    }

    public Action getAction(String className) {
        return this.actions.get(className);
    }
}
